﻿using System;

namespace Sustainalytics.Governance.BusinessLogic.Helpers
{
    public class ComposeFileUrl
    {
        public static string GetUrl(Guid fileId, string host, string controllerRoutePrefix)
        {
            if (host.Contains("+"))
                host = host.Replace("+", "0.0.0.0");

            if (!host.EndsWith("/"))
                host += "/";
            var hostUri = new Uri(host);
            return (new Uri(hostUri, hostUri.LocalPath + controllerRoutePrefix + fileId)).ToString().ToLowerInvariant();
        }
    }
}
